/*
ID:luongho3
LANG:JAVA
TASK:namenum
 */
package usaco.training.chap1.sec2;

import java.io.File;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class namenum {
	
	static String s;
	static String[] dict = new String[5000];
	static int dSize = 0;
	static int count = 0;

	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(new File("namenum.in"));
		Scanner sdict = new Scanner(new File("dict.txt"));		
		PrintStream ps = new PrintStream(new File("namenum.out"));
		System.setOut(ps);
		
		s = scanner.next();
		while (sdict.hasNext()) {
			dict[dSize] = sdict.next();
			dSize++;
		}
		
		dfs(0,"");
		if (count == 0) {
			System.out.println("NONE");
		}

	}

	private static void dfs(int idx, String word) {
		if (idx == s.length()) {
			if (Arrays.binarySearch(dict, 0, dSize, word) >= 0) {
				System.out.println(word);
				count++;
			}
		}
		else {
			for (int i=1;i<=3;++i) {
				char next = nextChar(s.charAt(idx),i);
				dfs(idx+1,word+next);
			}
		}
	}

	private static char nextChar(char ch, int n) {
		switch (ch) {
		case '2':
			if (n==1) {
				return 'A';
			}
			else if (n==2) {
				return 'B';
			}
			else if (n==3) {
				return 'C';
			}
		case '3':
			if (n==1) {
				return 'D';
			}
			else if (n==2) {
				return 'E';
			}
			else if (n==3) {
				return 'F';
			}
		case '4':
			if (n==1) {
				return 'G';
			}
			else if (n==2) {
				return 'H';
			}
			else if (n==3) {
				return 'I';
			}
		case '5':
			if (n==1) {
				return 'J';
			}
			else if (n==2) {
				return 'K';
			}
			else if (n==3) {
				return 'L';
			}
		case '6':
			if (n==1) {
				return 'M';
			}
			else if (n==2) {
				return 'N';
			}
			else if (n==3) {
				return 'O';
			}
		case '7':
			if (n==1) {
				return 'P';
			}
			else if (n==2) {
				return 'R';
			}
			else if (n==3) {
				return 'S';
			}
		case '8':
			if (n==1) {
				return 'T';
			}
			else if (n==2) {
				return 'U';
			}
			else if (n==3) {
				return 'V';
			}
		case '9':
			if (n==1) {
				return 'W';
			}
			else if (n==2) {
				return 'X';
			}
			else if (n==3) {
				return 'Y';
			}
		}
		return 0;
	}

}
